#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

include /usr/share/quilt/quilt.make

LDFLAGS += -fPIC
LIBS += -lpthread -lrt

DEB_HOST_ARCH_CPU   ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
DEB_HOST_ARCH_OS    ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
DEB_HOST_ARCH       ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
# Handle DEB_BUILD_OPTIONS=parallel=N
, := ,
ifneq (,$(filter parallel=%,$(subst $(,), ,$(DEB_BUILD_OPTIONS))))
  NUMJOBS := $(patsubst parallel=%,%,$(filter parallel=%,$(subst $(,), ,$(DEB_BUILD_OPTIONS))))
  MAKEFLAGS += -j$(NUMJOBS)
endif


CFLAGS += -Wall -g -O$(if $(findstring noopt,$(DEB_BUILD_OPTIONS)),0,2) 

ifeq ($(DEB_HOST_ARCH_CPU),arm)
CFLAGS += -fno-var-tracking
endif


%:
	dh $@
